home *** CD-ROM | disk | FTP | other *** search
- unit HVExtTimeKeeper;
-
- interface
-
- uses
- HVTimeKeeper2;
-
- type
- TExtTimeKeeper = class(TTimeKeeper)
- private
- function GetNowStr: string;
- function GetTodayName: string;
- public
- property NowStr: string read GetNowStr;
- property TodayName: string read GetTodayName;
- end;
-
- // A new access function is only needed if the public
- // interface has been extended
- function TimeKeeper: TExtTimeKeeper;
-
- implementation
-
- uses
- SysUtils;
-
- { TTimeKeeper }
-
- function TExtTimeKeeper.GetNowStr: string;
- begin
- Result := SysUtils.DateTimeToStr(Self.Now);
- end;
-
- function TExtTimeKeeper.GetTodayName: string;
- begin
- Result := SysUtils.LongDayNames[SysUtils.DayOfWeek(Self.Date)]
- end;
-
- // Simplified functional interface
-
- function TimeKeeper: TExtTimeKeeper;
- begin
- Result := TExtTimeKeeper(TExtTimeKeeper.Instance);
- end;
-
- initialization
- // Register ourselves as the new TTimeKeeper class
- TExtTimeKeeper.OverrideSingletonClass(TTimeKeeper, TExtTimeKeeper);
- end.